
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Mtons UI</title>

<!-- Bootstrap core CSS -->
<link href="../../dist/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="../../dist/css/dashboard.css" rel="stylesheet">

<script src="../../depends/jquery.min.js"></script>
</head>

<body>
	<div class="container-fluid">

		<div class="row">
			<h2 class="sub-header">Class</h2>

			<p>Class 方法可以方便的创建一个JS类，同时可以方便的对现有类进行继承。</p>
			<div class="table-responsive">
				<table class="table table-striped" style="width: 600px;">
					<tr>
						<th>方法</th>
						<th>说明</th>
					</tr>
					<tr>
						<td>init</td>
						<td>构造方法, 对象被实例化的时候调用</td>
					</tr>
					<tr>
						<td>extend</td>
						<td>扩展方法, 在原有的基础上增加/覆盖某些实现</td>
					</tr>
				</table>
			</div>
			
			<div>
				<h4>示例：</h4>
				<pre>
var Smile = mtons.Class.extend({
	init: function() {
		Log.out('init smile');
		
		this.name = 'super';
	},
	smile : function(name) {
		
		Log.out('super\'s smile > ' + name);
	}
});

var Hello = Smile.extend({
	init: function(){
		Log.out('init hello');
		Smile.fn.init.call(this);
	},
	say: function(){
		Log.out('hello\'s say');
	}
});

var Hello2 = Smile.extend({
	init: function(){
	},
	say: function(){
		Log.out('hello\'s say');
		
		this.smile('h2')
	}
});
				</pre>
			</div>
		</div>
	</div>
</body>
</html>
